package org.voovan.test.http;

import org.voovan.Global;
import org.voovan.http.extend.engineio.Config;
import org.voovan.http.extend.engineio.EIODispatcher;
import org.voovan.http.extend.engineio.EIOHandler;
import org.voovan.http.extend.socketio.SIODispatcher;
import org.voovan.http.extend.socketio.SIOHandler;
import org.voovan.http.message.HttpStatic;
import org.voovan.http.server.HttpRequest;
import org.voovan.http.server.HttpResponse;
import org.voovan.http.server.HttpRouter;
import org.voovan.http.server.WebServer;
import org.voovan.http.websocket.WebSocketRouter;
import org.voovan.http.websocket.WebSocketSession;
import org.voovan.http.websocket.exception.WebSocketFilterException;
import org.voovan.http.websocket.filter.StringFilter;
import org.voovan.network.exception.SendMessageException;
import org.voovan.tools.TDateTime;
import org.voovan.tools.TEnv;
import org.voovan.tools.TFile;
import org.voovan.tools.json.JSON;
import org.voovan.tools.log.Logger;

import java.io.File;
import java.io.IOException;


public class WebServerDemo {
	private static byte[] fileContent = TFile.loadFileFromContextPath("WEBAPP/index.htm");

	public static void main(String[] args) {
		WebServer webServer = WebServer.newInstance(args);
		webServer.getWebServerConfig().setCache(true);
		//性能测试请求
		webServer.get("/test", new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				resp.header().put(HttpStatic.CONTENT_TYPE_STRING, HttpStatic.TEXT_HTML_STRING);
				resp.write("{\"Depth\":[[1.00,56.23,1,1574415280],[1.01,73.79,1,1574415280],[1.02,6.76,1,1574415280],[1.03,41.11,1,1574415281],[1.04,52.46,1,1574415281],[1.05,54.73,1,1574415281],[1.06,52.05,1,1574415281],[1.07,67.39,1,1574415281],[1.08,55.76,1,1574415281],[1.09,46.28,1,1574415281],[1.10,53.71,1,1574415281],[1.11,45.20,1,1574415281],[1.12,44.52,1,1574415281],[1.13,37.70,1,1574415280],[1.14,51.35,1,1574415280],[1.15,69.80,1,1574415281],[1.16,70.29,1,1574415281],[1.17,5.61,1,1574415279],[1.18,38.18,1,1574415281],[1.19,28.94,1,1574415279],[1.20,42.00,1,1574415281],[1.21,2.04,1,1574415278],[1.22,25.76,1,1574415281],[1.23,15.28,1,1574415281],[1.24,23.75,1,1574415281],[1.25,4.32,1,1574415281],[1.26,0.38,1,1574415280],[1.27,0,1,1574415280],[1.28,0,1,1574415280],[1.29,0,1,1574415280],[1.30,0,1,1574415281],[1.31,0,-1,1574415281],[1.32,8.21,1,1574415281],[1.33,0,1,1574415281],[1.34,0,-1,1574415281],[1.35,0,1,1574415281],[1.36,0,-1,1574415280],[1.37,3.89,1,1574415281],[1.38,0,1,1574415281],[1.39,2.24,1,1574415281],[1.40,0,-1,1574415280],[1.41,0,-1,1574415280],[1.42,0,-1,1574415281],[1.43,0,-1,1574415281],[1.44,9.67,1,1574415281],[1.45,0,1,1574415280],[1.46,0,1,1574415281],[1.47,0,1,1574415281],[1.48,1.20,1,1574415281],[1.49,0,1,1574415281],[1.50,0,1,1574415281],[1.51,0,1,1574415281],[1.52,0,-1,1574415281],[1.53,0,1,1574415279],[1.54,0,1,1574415281],[1.55,0,1,1574415281],[1.56,0,1,1574415280],[1.57,0,-1,1574415280],[1.58,0,1,1574415281],[1.59,0,1,1574415281],[1.60,0,1,1574415281],[1.61,0,-1,1574415281],[1.62,0,-1,1574415281],[1.63,0,-1,1574415281],[1.64,0,1,1574415281],[1.65,0,-1,1574415280],[1.66,7.06,-1,1574415281],[1.67,17.85,-1,1574415280],[1.68,9.21,-1,1574415281],[1.69,5.84,-1,1574415280],[1.70,8.34,-1,1574415280],[1.71,16.23,-1,1574415281],[1.72,0,-1,1574415280],[1.73,42.60,-1,1574415276],[1.74,51.96,-1,1574415281],[1.75,25.18,-1,1574415279],[1.76,21.99,-1,1574415281],[1.77,27.49,-1,1574415280],[1.78,72.79,-1,1574415281],[1.79,49.17,-1,1574415280],[1.80,31.24,-1,1574415279],[1.81,48.31,-1,1574415280],[1.82,6.63,-1,1574415279],[1.83,44.40,-1,1574415279],[1.84,52.77,-1,1574415280],[1.85,39.04,-1,1574415280],[1.86,22.61,-1,1574415281],[1.87,21.77,-1,1574415279],[1.88,42.48,-1,1574415281],[1.89,23.90,-1,1574415280],[1.90,39.08,-1,1574415279],[1.91,25.36,-1,1574415281],[1.92,76.01,-1,1574415281],[1.93,16.49,-1,1574415278],[1.94,50.14,-1,1574415280],[1.95,31.09,-1,1574415280],[1.96,53.75,-1,1574415280],[1.97,66.57,-1,1574415280],[1.98,34.49,-1,1574415281],[1.99,73.39,-1,1574415281]],\"Trade\":[[1.46,5.43,7.9278,-1,1574415080],[1.44,0.86,1.2384,-1,1574415080],[1.44,1.35,1.9440,-1,1574415080],[1.44,0.19,0.2736,-1,1574415080],[1.65,1.16,1.9140,1,1574415080],[1.76,3.73,6.5648,1,1574415080],[1.44,6.67,9.6048,-1,1574415080],[1.63,1.92,3.1296,-1,1574415080],[1.63,6.74,10.9862,-1,1574415080],[1.63,0.62,1.0106,-1,1574415080],[1.62,6.87,11.1294,-1,1574415080],[1.62,1.48,2.3976,-1,1574415080],[1.58,0.66,1.0428,-1,1574415080],[1.58,4.71,7.4418,-1,1574415080],[1.56,0.73,1.1388,-1,1574415080],[1.51,0.63,0.9513,-1,1574415080],[1.76,5.34,9.3984,1,1574415081],[1.82,1.60,2.9120,1,1574415081],[1.51,2.62,3.9562,-1,1574415081],[1.48,0.32,0.4736,-1,1574415081],[1.82,7.34,13.3588,1,1574415081],[1.83,0.61,1.1163,1,1574415081],[1.76,3.22,5.6672,-1,1574415081],[1.76,1.90,3.3440,-1,1574415081],[1.76,2.02,3.5552,-1,1574415081],[1.67,2.77,4.6259,-1,1574415081],[1.48,0.84,1.2432,-1,1574415081],[1.44,0.16,0.2304,-1,1574415081],[1.44,1.53,2.2032,-1,1574415081],[1.44,2.48,3.5712,-1,1574415081],[1.59,0.90,1.4310,1,1574415081],[1.81,5.46,9.8826,1,1574415081],[1.59,3.57,5.6763,-1,1574415081],[1.62,2.01,3.2562,1,1574415081],[1.59,1.51,2.4009,-1,1574415081],[1.62,2.00,3.2400,1,1574415081],[1.67,2.60,4.3420,1,1574415081],[1.71,2.41,4.1211,-1,1574415081],[1.64,1.31,2.1484,-1,1574415081],[1.64,1.91,3.1324,-1,1574415081],[1.73,1.08,1.8684,-1,1574415081],[1.81,3.76,6.8056,1,1574415081],[1.83,4.35,7.9605,1,1574415081],[1.73,2.66,4.6018,-1,1574415081],[1.64,4.01,6.5764,-1,1574415081],[1.59,1.34,2.1306,-1,1574415081],[1.59,0.78,1.2402,-1,1574415081],[1.58,3.37,5.3246,-1,1574415081],[1.44,3.00,4.3200,-1,1574415081],[1.43,1.41,2.0163,-1,1574415081],[1.48,2.06,3.0488,-1,1574415081],[1.48,1.82,2.6936,-1,1574415081],[1.45,0.97,1.4065,-1,1574415081],[1.45,1.89,2.7405,-1,1574415081],[1.45,0.34,0.4930,-1,1574415081],[1.43,5.74,8.2082,-1,1574415081],[1.42,1.58,2.2436,-1,1574415081],[1.52,3.93,5.9736,1,1574415081],[1.79,3.23,5.7817,1,1574415081],[1.83,0.86,1.5738,1,1574415081],[1.83,1.34,2.4522,1,1574415081],[1.42,3.71,5.2682,-1,1574415081],[1.40,1.47,2.0580,-1,1574415081],[1.60,3.23,5.1680,-1,1574415081],[1.56,1.69,2.6364,-1,1574415081],[1.73,6.34,10.9682,1,1574415081],[1.79,0.52,0.9308,1,1574415081],[1.59,1.00,1.5900,-1,1574415081],[1.79,8.46,15.1434,1,1574415081],[1.77,4.56,8.0712,-1,1574415081],[1.59,3.38,5.3742,-1,1574415081],[1.79,0.05,0.0895,1,1574415081],[1.83,6.14,11.2362,1,1574415081],[1.59,3.04,4.8336,-1,1574415081],[1.56,0.70,1.0920,-1,1574415081],[1.40,1.49,2.0860,-1,1574415081],[1.39,2.25,3.1275,-1,1574415081],[1.36,1.33,1.8088,-1,1574415081],[1.36,1.11,1.5096,-1,1574415081],[1.30,1.43,1.8590,-1,1574415081],[1.28,4.21,5.3888,-1,1574415081],[1.63,2.75,4.4825,1,1574415081],[1.83,0.36,0.6588,1,1574415081],[1.83,1.73,3.1659,1,1574415081],[1.85,0.20,0.3700,1,1574415081],[1.85,0.49,0.9065,1,1574415081],[1.86,4.06,7.5516,1,1574415081],[1.74,4.28,7.4472,-1,1574415081],[1.74,2.26,3.9324,-1,1574415081],[1.69,0.31,0.5239,-1,1574415081],[1.28,0.23,0.2944,-1,1574415081],[1.28,0.54,0.6912,-1,1574415081],[1.45,8.15,11.8175,1,1574415081],[1.68,0.17,0.2856,1,1574415081],[1.56,5.22,8.1432,1,1574415081],[1.68,4.20,7.0560,1,1574415081],[1.66,1.89,3.1374,-1,1574415081],[1.66,1.36,2.2576,-1,1574415081],[1.66,3.57,5.9262,-1,1574415081],[1.66,2.99,4.9634,-1,1574415081],[1.55,4.36,6.7580,1,1574415081],[1.68,0.86,1.4448,1,1574415081],[1.68,1.79,3.0072,1,1574415081],[1.72,0.59,1.0148,1,1574415081],[1.79,5.51,9.8629,1,1574415081],[1.38,3.28,4.5264,1,1574415081],[1.43,2.68,3.8324,1,1574415081],[1.71,4.05,6.9255,1,1574415081],[1.71,0.82,1.4022,1,1574415081],[1.79,0.30,0.5370,1,1574415081],[1.81,1.02,1.8462,1,1574415081],[1.51,3.10,4.6810,1,1574415081],[1.51,0.45,0.6795,1,1574415081],[1.71,0.85,1.4535,1,1574415081],[1.75,6.91,12.0925,1,1574415081],[1.81,1.02,1.8462,1,1574415081],[1.61,0.69,1.1109,-1,1574415081],[1.61,7.89,12.7029,-1,1574415081],[1.34,1.13,1.5142,-1,1574415081],[1.39,1.71,2.3769,-1,1574415081],[1.81,1.75,3.1675,1,1574415081],[1.58,2.75,4.3450,-1,1574415081],[1.53,3.31,5.0643,-1,1574415081],[1.53,4.66,7.1298,-1,1574415081],[1.52,3.24,4.9248,1,1574415081],[1.69,1.43,2.4167,1,1574415081],[1.52,5.56,8.4512,-1,1574415081],[1.69,1.76,2.9744,1,1574415081],[1.81,2.95,5.3395,1,1574415081],[1.85,0.21,0.3885,-1,1574415081],[1.79,5.52,9.8808,-1,1574415081],[1.65,3.88,6.4020,-1,1574415081],[1.71,4.61,7.8831,-1,1574415081],[1.71,1.26,2.1546,-1,1574415081],[1.65,1.23,2.0295,-1,1574415081],[1.55,1.98,3.0690,-1,1574415081],[1.55,1.79,2.7745,-1,1574415081],[1.55,4.09,6.3395,-1,1574415081],[1.55,0.15,0.2325,-1,1574415081],[1.52,3.41,5.1832,-1,1574415081],[1.48,0.11,0.1628,-1,1574415081],[1.60,7.32,11.7120,-1,1574415081],[1.48,1.99,2.9452,-1,1574415081],[1.48,3.57,5.2836,-1,1574415081],[1.39,0.19,0.2641,-1,1574415081],[1.48,1.00,1.4800,1,1574415081],[1.56,2.11,3.2916,1,1574415081],[1.56,0.46,0.7176,1,1574415081],[1.72,0.55,0.9460,1,1574415081],[1.62,7.05,11.4210,-1,1574415081],[1.46,0.42,0.6132,1,1574415081],[1.46,0.81,1.1826,1,1574415081],[1.56,2.53,3.9468,-1,1574415081],[1.39,2.35,3.2665,-1,1574415081],[1.41,1.37,1.9317,1,1574415081],[1.41,0.99,1.3959,1,1574415081],[1.41,1.11,1.5651,1,1574415081],[1.45,0.99,1.4355,1,1574415081],[1.39,0.73,1.0147,-1,1574415081],[1.39,0.57,0.7923,-1,1574415081],[1.45,1.62,2.3490,1,1574415081],[1.45,6.56,9.5120,1,1574415081],[1.46,1.65,2.4090,1,1574415081],[1.39,0.53,0.7367,-1,1574415081],[1.35,3.70,4.9950,-1,1574415081],[1.46,2.70,3.9420,1,1574415081],[1.50,1.88,2.8200,1,1574415081],[1.56,2.68,4.1808,1,1574415081],[1.47,4.12,6.0564,1,1574415081],[1.45,0.74,1.0730,1,1574415081],[1.45,2.05,2.9725,1,1574415081],[1.47,1.77,2.6019,1,1574415081],[1.53,0.08,0.1224,1,1574415081],[1.53,3.40,5.2020,1,1574415081],[1.56,3.10,4.8360,1,1574415081],[1.57,0.58,0.9106,1,1574415081],[1.55,3.92,6.0760,1,1574415081],[1.57,0.81,1.2717,1,1574415081],[1.35,3.58,4.8330,-1,1574415081],[1.34,2.35,3.1490,-1,1574415081],[1.34,0.48,0.6432,-1,1574415081],[1.34,1.05,1.4070,-1,1574415081],[1.34,1.85,2.4790,-1,1574415081],[1.33,1.41,1.8753,-1,1574415081],[1.43,5.77,8.2511,-1,1574415081],[1.44,3.54,5.0976,1,1574415081],[1.44,2.42,3.4848,1,1574415081],[1.48,4.72,6.9856,1,1574415081],[1.43,0.76,1.0868,-1,1574415081],[1.33,0.27,0.3591,-1,1574415081],[1.48,4.36,6.4528,1,1574415081],[1.57,0.93,1.4601,1,1574415081],[1.60,4.07,6.5120,1,1574415081],[1.64,0.35,0.5740,1,1574415081],[1.39,3.04,4.2256,1,1574415081],[1.39,1.45,2.0155,1,1574415081],[1.64,4.00,6.5600,1,1574415081],[1.33,3.95,5.2535,-1,1574415081],[1.32,5.00,6.6000,-1,1574415081],[1.37,1.54,2.1098,1,1574415081],[1.37,3.12,4.2744,1,1574415081],[1.64,4.25,6.9700,1,1574415081],[1.66,0.55,0.9130,1,1574415081],[1.69,1.34,2.2646,1,1574415081],[1.32,1.38,1.8216,-1,1574415081],[1.30,1.92,2.4960,-1,1574415081],[1.69,0.52,0.8788,1,1574415081],[1.30,4.16,5.4080,-1,1574415081],[1.29,3.28,4.2312,-1,1574415081],[1.39,7.53,10.4667,1,1574415081],[1.53,0.93,1.4229,1,1574415081],[1.53,1.78,2.7234,1,1574415081],[1.69,4.66,7.8754,1,1574415081],[1.55,1.93,2.9915,-1,1574415081],[1.49,3.19,4.7531,1,1574415081],[1.49,0.35,0.5215,1,1574415081],[1.61,6.41,10.3201,1,1574415081],[1.52,1.67,2.5384,-1,1574415081],[1.52,3.70,5.6240,-1,1574415081],[1.52,3.95,6.0040,-1,1574415081],[1.52,0.41,0.6232,-1,1574415081],[1.48,2.61,3.8628,1,1574415081],[1.61,0.36,0.5796,1,1574415081],[1.69,0.59,0.9971,1,1574415081],[1.43,1.92,2.7456,-1,1574415081],[1.48,3.55,5.2540,-1,1574415081],[1.44,3.49,5.0256,-1,1574415081],[1.50,0.19,0.2850,1,1574415081],[1.48,3.90,5.7720,-1,1574415081],[1.44,3.09,4.4496,-1,1574415081],[1.44,0.86,1.2384,-1,1574415081],[1.44,0.25,0.3600,-1,1574415081],[1.43,2.64,3.7752,-1,1574415081],[1.50,2.49,3.7350,1,1574415081],[1.52,5.09,7.7368,1,1574415081],[1.51,2.32,3.5032,-1,1574415081],[1.51,1.49,2.2499,-1,1574415082],[1.48,3.57,5.2836,-1,1574415082],[1.52,2.89,4.3928,1,1574415082],[1.53,4.37,6.6861,1,1574415082],[1.69,0.94,1.5886,1,1574415082],[1.69,0.88,1.4872,1,1574415082],[1.48,0.97,1.4356,-1,1574415082],[1.48,1.47,2.1756,-1,1574415082],[1.43,5.39,7.7077,-1,1574415082],[1.41,1.18,1.6638,-1,1574415082],[1.39,1.69,2.3491,-1,1574415082],[1.48,2.57,3.8036,1,1574415082],[1.48,0.72,1.0656,1,1574415082],[1.54,4.05,6.2370,1,1574415082],[1.56,0.61,0.9516,1,1574415082],[1.56,5.88,9.1728,1,1574415082],[1.64,2.41,3.9524,-1,1574415082],[1.39,0.71,0.9869,-1,1574415082],[1.39,5.15,7.1585,-1,1574415082],[1.39,1.74,2.4186,-1,1574415082],[1.68,0.93,1.5624,1,1574415082],[1.53,2.28,3.4884,-1,1574415082],[1.39,2.38,3.3082,-1,1574415082],[1.39,2.17,3.0163,-1,1574415082],[1.68,0.51,0.8568,1,1574415082],[1.69,4.16,7.0304,1,1574415082],[1.69,1.99,3.3631,1,1574415082],[1.70,5.53,9.4010,1,1574415082],[1.72,1.54,2.6488,1,1574415082],[1.37,7.34,10.0558,-1,1574415082],[1.69,3.47,5.8643,-1,1574415082],[1.66,1.40,2.3240,-1,1574415082],[1.66,0.49,0.8134,-1,1574415082],[1.62,6.42,10.4004,-1,1574415082],[1.62,2.89,4.6818,-1,1574415082],[1.72,1.25,2.1500,1,1574415082],[1.62,0.06,0.0972,-1,1574415082],[1.48,3.03,4.4844,-1,1574415082],[1.47,1.44,2.1168,-1,1574415082],[1.37,0.82,1.1234,-1,1574415082],[1.34,1.32,1.7688,-1,1574415082],[1.33,0.42,0.5586,-1,1574415082],[1.33,2.16,2.8728,-1,1574415082],[1.30,6.54,8.5020,-1,1574415082],[1.29,1.38,1.7802,-1,1574415082],[1.28,0.18,0.2304,-1,1574415082],[1.28,2.45,3.1360,-1,1574415082],[1.30,0.48,0.6240,1,1574415082],[1.59,3.84,6.1056,-1,1574415082],[1.65,6.16,10.1640,1,1574415082],[1.68,2.08,3.4944,1,1574415082],[1.59,2.36,3.7524,-1,1574415082],[1.28,5.45,6.9760,-1,1574415082],[1.26,0.39,0.4914,-1,1574415082],[1.68,0.90,1.5120,1,1574415082],[1.29,1.16,1.4964,-1,1574415082],[1.26,0.66,0.8316,-1,1574415082],[1.68,0.32,0.5376,1,1574415082],[1.52,4.68,7.1136,-1,1574415082],[1.52,3.19,4.8488,-1,1574415082],[1.68,5.75,9.6600,1,1574415082],[1.72,1.84,3.1648,1,1574415082],[1.72,1.50,2.5800,1,1574415082],[1.52,0.44,0.6688,-1,1574415082],[1.52,7.69,11.6888,-1,1574415082],[1.71,0.28,0.4788,-1,1574415082],[1.67,3.64,6.0788,-1,1574415082],[1.67,4.58,7.6486,-1,1574415082],[1.63,4.23,6.8949,1,1574415082],[1.72,0.99,1.7028,1,1574415082],[1.52,0.33,0.5016,-1,1574415082],[1.37,0.88,1.2056,-1,1574415082],[1.62,4.52,7.3224,1,1574415082],[1.37,0.90,1.2330,-1,1574415082],[1.30,0.25,0.3250,-1,1574415082],[1.26,2.64,3.3264,-1,1574415082],[1.26,2.09,2.6334,-1,1574415082],[1.62,4.09,6.6258,1,1574415082],[1.72,2.12,3.6464,1,1574415082],[1.29,2.75,3.5475,1,1574415082],[1.70,5.02,8.5340,1,1574415082],[1.72,3.31,5.6932,1,1574415082],[1.72,0.31,0.5332,1,1574415082],[1.72,5.85,10.0620,1,1574415082],[1.73,0.08,0.1384,1,1574415082],[1.62,0.28,0.4536,-1,1574415082],[1.48,3.85,5.6980,-1,1574415082],[1.47,2.59,3.8073,-1,1574415082],[1.37,0.39,0.5343,-1,1574415082],[1.39,4.11,5.7129,-1,1574415082],[1.37,0.85,1.1645,-1,1574415082],[1.37,0.50,0.6850,-1,1574415082],[1.48,3.63,5.3724,-1,1574415082],[1.44,0.34,0.4896,1,1574415082],[1.61,6.81,10.9641,-1,1574415082],[1.39,5.28,7.3392,-1,1574415082],[1.37,3.66,5.0142,-1,1574415082],[1.45,0.32,0.4640,1,1574415082],[1.45,2.64,3.8280,1,1574415082],[1.66,1.18,1.9588,1,1574415082],[1.73,6.12,10.5876,1,1574415082],[1.73,0.84,1.4532,1,1574415082],[1.62,3.52,5.7024,-1,1574415082],[1.51,6.06,9.1506,-1,1574415082],[1.51,3.32,5.0132,-1,1574415082],[1.37,2.83,3.8771,-1,1574415082],[1.35,0.25,0.3375,-1,1574415082],[1.67,3.77,6.2959,1,1574415082],[1.73,1.80,3.1140,1,1574415082],[1.65,4.52,7.4580,-1,1574415082],[1.53,3.54,5.4162,-1,1574415082],[1.53,6.35,9.7155,-1,1574415082],[1.48,3.31,4.8988,-1,1574415082],[1.48,0.55,0.8140,-1,1574415082],[1.35,2.75,3.7125,-1,1574415082],[1.41,4.65,6.5565,1,1574415082],[1.35,4.50,6.0750,-1,1574415082],[1.33,1.91,2.5403,-1,1574415082],[1.31,0.99,1.2969,-1,1574415082],[1.41,0.56,0.7896,1,1574415082],[1.55,1.79,2.7745,1,1574415082],[1.46,3.16,4.6136,-1,1574415082],[1.55,4.16,6.4480,1,1574415082],[1.70,2.62,4.4540,1,1574415082],[1.73,1.14,1.9722,1,1574415082],[1.73,0.24,0.4152,1,1574415082],[1.46,2.85,4.1610,-1,1574415082],[1.44,1.57,2.2608,-1,1574415082],[1.44,3.25,4.6800,-1,1574415082],[1.40,0.79,1.1060,1,1574415082],[1.53,0.96,1.4688,-1,1574415082],[1.31,5.27,6.9037,-1,1574415082],[1.29,2.00,2.5800,-1,1574415082],[1.29,3.71,4.7859,-1,1574415082],[1.29,4.98,6.4242,-1,1574415082],[1.29,1.03,1.3287,-1,1574415082],[1.27,6.68,8.4836,1,1574415082],[1.33,0.54,0.7182,1,1574415082],[1.33,0.24,0.3192,1,1574415082],[1.33,2.88,3.8304,1,1574415082],[1.50,0.31,0.4650,1,1574415082],[1.50,5.57,8.3550,1,1574415082],[1.55,3.12,4.8360,1,1574415082],[1.55,5.06,7.8430,1,1574415082],[1.42,1.60,2.2720,-1,1574415082],[1.53,5.83,8.9199,-1,1574415082],[1.55,1.14,1.7670,1,1574415082],[1.66,7.96,13.2136,1,1574415082],[1.73,0.83,1.4359,1,1574415082],[1.57,2.54,3.9878,-1,1574415082],[1.73,5.05,8.7365,1,1574415082],[1.73,0.56,0.9688,1,1574415082],[1.73,0.78,1.3494,1,1574415082],[1.62,3.87,6.2694,-1,1574415082],[1.62,1.96,3.1752,-1,1574415082],[1.62,0.90,1.4580,-1,1574415082],[1.57,1.37,2.1509,-1,1574415082],[1.57,1.04,1.6328,-1,1574415082],[1.57,0.75,1.1775,-1,1574415082],[1.53,1.94,2.9682,-1,1574415082],[1.50,3.62,5.4300,-1,1574415082],[1.50,2.58,3.8700,-1,1574415082],[1.45,3.64,5.2780,-1,1574415082],[1.44,2.04,2.9376,-1,1574415082],[1.44,0.69,0.9936,-1,1574415082],[1.42,0.78,1.1076,-1,1574415082],[1.73,2.23,3.8579,1,1574415082],[1.74,4.23,7.3602,1,1574415082],[1.42,1.85,2.6270,-1,1574415082],[1.40,0.33,0.4620,-1,1574415082],[1.74,3.83,6.6642,1,1574415082],[1.49,4.94,7.3606,1,1574415082],[1.74,0.41,0.7134,1,1574415082],[1.74,1.26,2.1924,1,1574415082],[1.74,1.92,3.3408,1,1574415082],[1.40,2.42,3.3880,-1,1574415082],[1.52,4.11,6.2472,-1,1574415082],[1.52,0.06,0.0912,-1,1574415082],[1.40,2.45,3.4300,-1,1574415082],[1.39,1.05,1.4595,-1,1574415082],[1.39,1.77,2.4603,-1,1574415082],[1.38,6.82,9.4116,-1,1574415082],[1.36,0.66,0.8976,-1,1574415082],[1.36,0.13,0.1768,-1,1574415082],[1.35,0.56,0.7560,-1,1574415082],[1.34,1.37,1.8358,-1,1574415082],[1.36,0.32,0.4352,1,1574415082],[1.42,4.76,6.7592,1,1574415082],[1.42,1.73,2.4566,1,1574415082],[1.43,0.75,1.0725,1,1574415082],[1.52,7.46,11.3392,-1,1574415082],[1.34,2.33,3.1222,-1,1574415082],[1.34,3.35,4.4890,-1,1574415082],[1.34,1.78,2.3852,-1,1574415082],[1.34,0.84,1.1256,-1,1574415082],[1.34,4.91,6.5794,-1,1574415082],[1.27,1.76,2.2352,-1,1574415082],[1.27,1.51,1.9177,-1,1574415082],[1.48,6.56,9.7088,1,1574415082],[1.48,0.80,1.1840,1,1574415082],[1.62,4.62,7.4844,1,1574415082],[1.70,2.19,3.7230,1,1574415082],[1.70,2.79,4.7430,1,1574415082],[1.70,0.17,0.2890,1,1574415082],[1.74,5.35,9.3090,1,1574415082],[1.47,6.79,9.9813,1,1574415082],[1.74,1.45,2.5230,1,1574415082],[1.76,4.58,8.0608,1,1574415082],[1.76,2.19,3.8544,1,1574415082],[1.53,1.52,2.3256,-1,1574415082],[1.46,0.16,0.2336,-1,1574415082],[1.46,1.84,2.6864,-1,1574415082],[1.51,1.38,2.0838,1,1574415082],[1.65,4.55,7.5075,1,1574415082],[1.46,2.88,4.2048,-1,1574415082],[1.49,1.02,1.5198,1,1574415082],[1.59,2.00,3.1800,1,1574415082],[1.65,1.83,3.0195,1,1574415082],[1.76,0.91,1.6016,1,1574415082],[1.76,0.21,0.3696,1,1574415082],[1.47,5.45,8.0115,1,1574415082],[1.52,3.55,5.3960,-1,1574415082],[1.46,0.04,0.0584,-1,1574415082],[1.76,1.56,2.7456,1,1574415082],[1.46,2.47,3.6062,-1,1574415082],[1.39,3.07,4.2673,-1,1574415082],[1.36,0.24,0.3264,-1,1574415082],[1.73,5.37,9.2901,-1,1574415082],[1.40,1.47,2.0580,1,1574415082],[1.39,5.30,7.3670,1,1574415082],[1.38,2.90,4.0020,-1,1574415082],[1.36,7.07,9.6152,-1,1574415082],[1.39,1.80,2.5020,1,1574415082],[1.39,3.23,4.4897,-1,1574415082],[1.36,0.48,0.6528,-1,1574415082],[1.36,5.45,7.4120,-1,1574415082],[1.36,1.83,2.4888,-1,1574415082],[1.35,0.93,1.2555,-1,1574415082],[1.40,1.15,1.6100,1,1574415082],[1.46,3.01,4.3946,1,1574415082],[1.46,0.43,0.6278,1,1574415082],[1.46,1.98,2.8908,1,1574415082],[1.65,1.46,2.4090,1,1574415082],[1.35,1.03,1.3905,-1,1574415082],[1.62,4.41,7.1442,-1,1574415082],[1.35,0.22,0.2970,-1,1574415082],[1.35,4.75,6.4125,-1,1574415082],[1.50,0.68,1.0200,1,1574415082],[1.65,3.55,5.8575,1,1574415082],[1.58,8.62,13.6196,-1,1574415082],[1.41,1.39,1.9599,-1,1574415082],[1.65,0.99,1.6335,1,1574415082],[1.67,7.76,12.9592,1,1574415082],[1.57,8.44,13.2508,1,1574415082],[1.67,0.93,1.5531,1,1574415082],[1.41,3.70,5.2170,-1,1574415082],[1.39,2.95,4.1005,-1,1574415082],[1.35,1.54,2.0790,-1,1574415082],[1.63,3.81,6.2103,-1,1574415082],[1.35,1.21,1.6335,-1,1574415082],[1.33,5.25,6.9825,-1,1574415082],[1.32,0.92,1.2144,-1,1574415082],[1.51,3.69,5.5719,1,1574415082],[1.67,0.80,1.3360,1,1574415082],[1.69,0.63,1.0647,1,1574415082],[1.32,3.67,4.8444,-1,1574415082],[1.31,4.43,5.8033,-1,1574415082],[1.30,1.90,2.4700,1,1574415082],[1.69,1.61,2.7209,1,1574415082],[1.69,1.73,2.9237,1,1574415083],[1.69,6.24,10.5456,1,1574415083],[1.72,0.71,1.2212,1,1574415083],[1.33,2.83,3.7639,-1,1574415083],[1.53,6.63,10.1439,1,1574415083],[1.37,6.70,9.1790,-1,1574415083],[1.39,0.30,0.4170,1,1574415083],[1.44,1.95,2.8080,-1,1574415083],[1.53,0.27,0.4131,1,1574415083],[1.72,1.88,3.2336,1,1574415083],[1.44,0.86,1.2384,-1,1574415083],[1.37,0.84,1.1508,-1,1574415083],[1.33,3.93,5.2269,-1,1574415083],[1.37,2.66,3.6442,1,1574415083],[1.33,0.64,0.8512,-1,1574415083],[1.33,3.31,4.4023,1,1574415083],[1.37,0.57,0.7809,1,1574415083],[1.37,1.74,2.3838,1,1574415083],[1.53,8.34,12.7602,1,1574415083],[1.61,1.36,2.1896,1,1574415083],[1.61,2.83,4.5563,1,1574415083],[1.61,5.33,8.5813,1,1574415083],[1.64,0.07,0.1148,1,1574415083],[1.50,3.31,4.9650,-1,1574415083],[1.34,1.82,2.4388,-1,1574415083],[1.41,0.83,1.1703,1,1574415083],[1.37,2.56,3.5072,-1,1574415083],[1.36,7.51,10.2136,-1,1574415083],[1.41,1.17,1.6497,1,1574415083],[1.48,2.68,3.9664,1,1574415083],[1.64,3.17,5.1988,1,1574415083],[1.65,2.53,4.1745,1,1574415083],[1.45,2.17,3.1465,-1,1574415083],[1.45,4.67,6.7715,-1,1574415083],[1.44,2.19,3.1536,-1,1574415083],[1.36,1.66,2.2576,-1,1574415083],[1.34,0.98,1.3132,-1,1574415083],[1.34,6.88,9.2192,-1,1574415083],[1.31,2.68,3.5108,-1,1574415083],[1.31,3.55,4.6505,-1,1574415083],[1.29,0.33,0.4257,-1,1574415083],[1.29,1.16,1.4964,-1,1574415083],[1.28,1.32,1.6896,-1,1574415083],[1.33,6.33,8.4189,-1,1574415083],[1.33,1.07,1.4231,1,1574415083],[1.33,0.32,0.4256,1,1574415083],[1.51,2.12,3.2012,1,1574415083],[1.28,3.37,4.3136,-1,1574415083],[1.51,0.25,0.3775,1,1574415083],[1.37,2.46,3.3702,1,1574415083],[1.49,5.24,7.8076,1,1574415083],[1.49,1.03,1.5347,1,1574415083],[1.51,4.44,6.7044,1,1574415083],[1.52,0.61,0.9272,1,1574415083],[1.35,2.01,2.7135,1,1574415083],[1.35,0.47,0.6345,1,1574415083],[1.52,1.98,3.0096,1,1574415083],[1.52,1.24,1.8848,1,1574415083],[1.34,0.73,0.9782,-1,1574415083],[1.30,7.01,9.1130,-1,1574415083],[1.30,0.44,0.5720,-1,1574415083],[1.28,0.71,0.9088,-1,1574415083],[1.27,5.61,7.1247,-1,1574415083],[1.26,2.15,2.7090,-1,1574415083],[1.36,7.34,9.9824,-1,1574415083],[1.36,0.19,0.2584,-1,1574415083],[1.26,2.12,2.6712,-1,1574415083],[1.26,0.87,1.0962,-1,1574415083],[1.26,4.61,5.8086,-1,1574415083],[1.26,0.96,1.2096,-1,1574415083],[1.39,7.53,10.4667,1,1574415083],[1.26,0.42,0.5292,-1,1574415083],[1.26,2.08,2.6208,-1,1574415083],[1.25,1.26,1.5750,-1,1574415083],[1.36,2.27,3.0872,1,1574415083],[1.36,0.50,0.6800,1,1574415083],[1.36,6.82,9.2752,1,1574415083],[1.36,1.12,1.5232,1,1574415083],[1.39,1.89,2.6271,1,1574415083],[1.52,2.79,4.2408,1,1574415083],[1.53,0.65,0.9945,1,1574415083],[1.25,0.36,0.4500,-1,1574415083],[1.25,5.43,6.7875,-1,1574415083],[1.25,0.04,0.0500,-1,1574415083],[1.25,2.55,3.1875,-1,1574415083],[1.25,1.65,2.0625,-1,1574415083],[1.25,4.23,5.2875,-1,1574415083],[1.25,2.21,2.7625,-1,1574415083],[1.53,2.71,4.1463,1,1574415083],[1.53,0.06,0.0918,1,1574415083],[1.53,6.21,9.5013,1,1574415083],[1.56,1.49,2.3244,1,1574415083],[1.56,2.54,3.9624,1,1574415083],[1.44,6.77,9.7488,-1,1574415083],[1.56,4.37,6.8172,1,1574415083],[1.56,4.96,7.7376,1,1574415083],[1.44,0.55,0.7920,-1,1574415083],[1.29,1.19,1.5351,1,1574415083],[1.34,3.59,4.8106,1,1574415083],[1.47,3.99,5.8653,1,1574415083],[1.56,0.59,0.9204,1,1574415083],[1.41,3.92,5.5272,-1,1574415083],[1.25,1.98,2.4750,-1,1574415083],[1.25,3.24,4.0500,-1,1574415083],[1.36,4.73,6.4328,1,1574415083],[1.39,0.04,0.0556,1,1574415083],[1.26,3.55,4.4730,-1,1574415083],[1.25,3.02,3.7750,-1,1574415083],[1.25,2.81,3.5125,-1,1574415083],[1.37,6.67,9.1379,1,1574415083],[1.34,3.20,4.2880,-1,1574415083],[1.37,1.75,2.3975,1,1574415083],[1.39,0.05,0.0695,1,1574415083],[1.39,8.25,11.4675,1,1574415083],[1.56,1.81,2.8236,1,1574415083],[1.35,2.29,3.0915,-1,1574415083],[1.34,2.07,2.7738,-1,1574415083],[1.34,4.39,5.8826,-1,1574415083],[1.27,2.32,2.9464,-1,1574415083],[1.56,0.38,0.5928,1,1574415083],[1.57,0.23,0.3611,1,1574415083],[1.27,1.29,1.6383,-1,1574415083],[1.25,1.39,1.7375,-1,1574415083],[1.24,2.40,2.9760,-1,1574415083],[1.29,0.45,0.5805,1,1574415083],[1.57,3.41,5.3537,1,1574415083],[1.59,0.23,0.3657,1,1574415083],[1.60,2.18,3.4880,1,1574415083],[1.60,0.36,0.5760,1,1574415083],[1.60,5.26,8.4160,1,1574415083],[1.59,3.39,5.3901,1,1574415083],[1.59,4.42,7.0278,1,1574415083],[1.24,2.61,3.2364,-1,1574415083],[1.24,3.56,4.4144,-1,1574415083],[1.59,0.60,0.9540,1,1574415083],[1.60,0.97,1.5520,1,1574415083],[1.61,1.90,3.0590,1,1574415083],[1.24,2.57,3.1868,-1,1574415083],[1.24,6.91,8.5684,-1,1574415083],[1.24,2.62,3.2488,-1,1574415083],[1.24,6.13,7.6012,-1,1574415083],[1.24,0.84,1.0416,-1,1574415083],[1.23,7.41,9.1143,-1,1574415083],[1.23,1.12,1.3776,-1,1574415083],[1.61,0.52,0.8372,1,1574415083],[1.61,4.02,6.4722,1,1574415083],[1.37,6.66,9.1242,-1,1574415083],[1.33,2.74,3.6442,1,1574415083],[1.56,1.47,2.2932,1,1574415083],[1.56,2.64,4.1184,1,1574415083],[1.61,0.07,0.1127,1,1574415083],[1.49,4.25,6.3325,-1,1574415083],[1.49,0.79,1.1771,-1,1574415083],[1.54,4.12,6.3448,-1,1574415083],[1.49,2.03,3.0247,-1,1574415083],[1.42,0.90,1.2780,-1,1574415083],[1.49,1.67,2.4883,1,1574415083],[1.61,1.20,1.9320,1,1574415083],[1.61,1.45,2.3345,1,1574415083],[1.59,5.54,8.8086,-1,1574415083],[1.59,2.96,4.7064,-1,1574415083],[1.51,3.77,5.6927,-1,1574415083],[1.51,1.10,1.6610,-1,1574415083],[1.61,1.61,2.5921,1,1574415083],[1.61,5.70,9.1770,1,1574415083],[1.63,3.36,5.4768,1,1574415083],[1.59,4.64,7.3776,-1,1574415083],[1.55,0.58,0.8990,-1,1574415083],[1.55,2.59,4.0145,-1,1574415083],[1.63,1.40,2.2820,1,1574415083],[1.63,1.96,3.1948,1,1574415083],[1.63,0.61,0.9943,1,1574415083],[1.64,1.44,2.3616,1,1574415083],[1.55,3.79,5.8745,-1,1574415083],[1.51,1.57,2.3707,-1,1574415083],[1.51,1.98,2.9898,-1,1574415083],[1.42,0.51,0.7242,-1,1574415083],[1.30,1.89,2.4570,-1,1574415083],[1.43,1.13,1.6159,1,1574415083],[1.46,2.43,3.5478,1,1574415083],[1.46,1.84,2.6864,1,1574415083],[1.59,2.85,4.5315,1,1574415083],[1.58,0.17,0.2686,1,1574415083],[1.30,5.76,7.4880,-1,1574415083],[1.29,1.75,2.2575,-1,1574415083],[1.29,5.56,7.1724,-1,1574415083],[1.29,0.59,0.7611,-1,1574415083],[1.29,4.73,6.1017,-1,1574415083],[1.58,4.28,6.7624,1,1574415083],[1.59,2.03,3.2277,1,1574415083],[1.59,2.59,4.1181,1,1574415083],[1.63,8.73,14.2299,1,1574415083],[1.63,0.13,0.2119,1,1574415083],[1.64,2.29,3.7556,1,1574415083],[1.65,3.29,5.4285,1,1574415083],[1.59,1.18,1.8762,-1,1574415083],[1.65,1.87,3.0855,1,1574415083],[1.65,2.74,4.5210,1,1574415083],[1.65,1.85,3.0525,1,1574415083],[1.68,3.37,5.6616,1,1574415083],[1.69,2.23,3.7687,1,1574415083],[1.69,5.04,8.5176,1,1574415083],[1.69,0.68,1.1492,1,1574415083],[1.59,2.36,3.7524,-1,1574415083],[1.52,0.31,0.4712,-1,1574415083],[1.69,");
//				resp.write("OK");
			}
		});

		webServer.post("/test", new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
//				resp.write("[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]" +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]" +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]" +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]" + "[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]" +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]"  +
//						"[{\"id\":4174,\"randomNumber\":331},{\"id\":51,\"randomNumber\":6544},{\"id\":4462,\"randomNumber\":952},{\"id\":2221,\"randomNumber\":532},{\"id\":9276,\"randomNumber\":3097},{\"id\":3056,\"randomNumber\":7293},{\"id\":6964,\"randomNumber\":620},{\"id\":675,\"randomNumber\":6601},{\"id\":8414,\"randomNumber\":6569},{\"id\":2753,\"randomNumber\":4065}]");
				resp.write("OK");
			}
		});

		//性能测试请求
		webServer.post("/upload", new HttpRouter(){
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				try {
					req.saveUploadedFile("file", "./" + req.getParameter("file"));
					resp.write("Success");
				} catch (Exception e){
					e.printStackTrace();
				}
			}
		});

		//性能测试请求
		webServer.get("/async", new HttpRouter(){
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				HttpResponse asyncResponse = resp.getAsyncResponse();
				Global.getThreadPool().execute(()->{
					TEnv.sleep(100);
					asyncResponse.write("async response");
					try {
						asyncResponse.send();
					} catch (IOException e) {
						e.printStackTrace();
					}
				});
			}
		});

		//普通 GET 请求
		webServer.get("/",  new HttpRouter(){
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				Logger.info("Client info: " + req.getRemoteAddres() + ":" + req.getRemotePort());
				Logger.simple("Request info: " + req.protocol());
				//Session 测试
				{
					String now = TDateTime.now();
					if (req.getSession() != null && req.getSession().getAttribute("Time") != null) {
						Logger.simple("Session "+ req.getSession().getId() +" saved time is: " + req.getSession().getAttribute("Time") + " SavedTime: " + now);
					}
					req.getSession().setAttribute("Time", now);
				}
				resp.write(fileContent);
				resp.write("{"
						+ "\"Method\":\"NormalGET\","
						+ "\"name\":\"" + req.getParameter("name") + "\","
						+ "\"age\":\"" + req.getParameter("age") + "\""
						+ "}");
			}
		});

		//带路径参数的 GET 请求
		webServer.get("/Star/:name/:age",  new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				Logger.info("Client info: " + req.getRemoteAddres() + ":" + req.getRemotePort());
				Logger.simple("Request info: " + req.protocol());
				resp.write(fileContent);
				resp.write("{"
						+ "\"Method\":\"PathGET\","
						+ "\"name\":\"" + req.getParameter("name") + "\","
						+ "\"age\":\"" + req.getParameter("age") + "\""
						+ "}");
			}
		});

		//路径模糊匹配
		webServer.get("/test/t*t/kkk/*",  new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				Logger.info("Client info: " + req.getRemoteAddres() + ":" + req.getRemotePort());
				Logger.simple("Request info: " + req.protocol());
				resp.write(fileContent);
				resp.write("{"
						+ "\"Method\":\"FuzzyMatching\""
						+ "}");
			}
		});


		// 重定向
		webServer.get("/redirect",  new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				Logger.info("Client info: " + req.getRemoteAddres() + ":" + req.getRemotePort());
				Logger.simple("Request info: " + req.protocol());
				resp.redirct("http://www.baidu.com");
			}
		});

		//普通 POST 请求
		webServer.post("/",  new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				Logger.info("Client info: " + req.getRemoteAddres() + ":" + req.getRemotePort());
				Logger.simple("Request info: " + req.protocol());
				resp.write(fileContent);
				String contentType = req.header().get("Content-Type").split(";")[0];
				resp.write("{"
						+ "\"Method\":\"" + contentType + "\","
						+ "\"name\":\"" + req.getParameter("name") + "\","
						+ "\"age\":\"" + req.getParameter("age") + "\""
						+ "}");
			}
		});

		//自定义方法测试
		webServer.otherMethod("LOCK","/:test", new HttpRouter() {
			public void process(HttpRequest req, HttpResponse resp) throws Exception {
				resp.body().write("User Defined HTTP method is " + req.protocol().getMethod());
				Logger.simple("Query");
			}
		});

		webServer.socket("/websocket", new WebSocketRouter() {

			@Override
			public Object onOpen(WebSocketSession webSocketSession) {
				Logger.info("onOpen: WebSocket connect!");

				//调用发送函数发送
				try {

					String mm= new String("opened");
					webSocketSession.send(mm);
				} catch (Exception e) {
					e.printStackTrace();
				}

				return "Server writeToChannel: onOpen";
			}

			@Override
			public Object onRecived(WebSocketSession webSocketSession, Object obj) {
				String msg = (String)obj;
				Logger.info("onRecive: "+msg);
				msg = "This is server message. Client message: \r\n\t\""+msg+"\"";

				//调用发送函数发送
				try {
					webSocketSession.send("Send by writeToChannel method in onRecive");
				} catch (SendMessageException | WebSocketFilterException e) {
					e.printStackTrace();
				}
				return msg;
			}

			@Override
			public void onSent(WebSocketSession webSocketSession, Object message) {
				Logger.info("----> onSend: " + message);
			}

			@Override
			public void onClose(WebSocketSession webSocketSession) {
				Logger.info("WebSocket close!");
			}
		}.addFilterChain(new StringFilter()));

		//engine.io 测试用例
		webServer.socket("/engine.io", new EIODispatcher(new Config())
				.on("connection", new EIOHandler() {
					@Override
					public String execute(String msg) {
						try {
							this.send("asdfasdf");
						} catch (SendMessageException e) {
							e.printStackTrace();
						} catch (WebSocketFilterException e) {
							e.printStackTrace();
						}
						Logger.simple("connected");
						return "server connected";
					}
				}).on("close", new EIOHandler() {
					@Override
					public String execute(String msg) {
						Logger.simple("closed");
						return null;
					}
				}).on("message", new EIOHandler() {
					@Override
					public String execute(String msg) {
						Logger.simple("message: " + msg);
						return "server "+msg;
					}
				}).on("ping", new EIOHandler() {
					@Override
					public String execute(String msg) {
						Logger.simple("ping");
						return null;
					}
				}).on("pong", new EIOHandler() {
					@Override
					public String execute(String msg) {
						Logger.simple("pong");
						return null;
					}
				}));

		//socket.io 测试用例
		webServer.socket("/socket.io", new SIODispatcher(new Config())
				.on("connect", new SIOHandler() {
					@Override
					public String execute(Object... args) {
						Logger.simple("connect");
						return null;
					}
				})
				.on("disconnect", new SIOHandler() {
					@Override
					public String execute(Object... args) {
						Logger.simple("disconnect");
						return null;
					}
				})
				.on("hello", new SIOHandler() {
					@Override
					public Object execute(Object... args) {
						Logger.simple("hello: "+ JSON.toJSON(args));

						//触发前端的事件
						try {
							//事件名, 回掉, 事件参数
							emit("show", new SIOHandler() {
								@Override
								public Object execute(Object... args) {
									Logger.simple(args);
									return null;
								}
							}, "aaaa");
						} catch (SendMessageException e) {
							e.printStackTrace();
						} catch (WebSocketFilterException e) {
							e.printStackTrace();
						}

						return "hello back message";
					}
				})
		);

		webServer.serve();

	}
}
